<template>
  <div class="app">
    <el-select v-model="value" placeholder="请选择">
      <el-option
        v-for="item in options"
        :key="item.value"
        :label="item.label"
        :value="item.value"
        @click.native="handleSelect(item)"
      >
      </el-option>
    </el-select>
    <router-view :type="value"></router-view>
  </div>
</template>

<script>
import { findRowSeatByMeetingId } from "@/apis/common.js";
export default {
  data() {
    return {
      options: [
        {
          value: "0",
          label: "主席台",
          path: "/meetingRoomm1",
        },
        {
          value: "1",
          label: "市行政中心16楼中庭会议室",
          path: "/meetingRoomm2",
        },
        {
          value: "2",
          label: "市行政中心8楼会场座位表",
          path: "/meetingRoomm3",
        },
        {
          value: "3",
          label: "市行政中心3楼多功能会议室座位表",
          path: "/meetingRoomm4",
        },
        {
          value: "4",
          label: "三楼东会议报告厅席位图",
          path: "/meetingRoomm5",
        },
      ],
      value: "0",
    };
  },
  mounted() {
    this.getRowSeatByMeetingId()
  },
  computed: {},
  methods: {
    handleSelect(item) {
      console.log("item", item);
      if (item.path) {
        this.$router.push(item.path);
      }
    },
    async getRowSeatByMeetingId() {
      // 获取当前 URL
      const url = new URL(document.location.href);
      const params = new URLSearchParams(url.search);
      // 获取参数值
      const meetingId = params.get("meetingId");
      await findRowSeatByMeetingId({
        meetingId: meetingId,
        type: "1",
      }).then((res) => {
        console.log("首页获取会议室排座信息", res);
        if (res.code == 200 && res.data !== []) {
          // this.meetingTitle = res.data.meetingRoomName;
          this.value = res.data.type
          this.handleSelect(this.options[Number(this.value)]);
        }
      });
    },
  },
};
</script>

<style lang="less" scope>
@import "./style/index.less";
.app {
  width: 100%;
  padding: 40px;
  height: 800px;
  margin: 0 auto;
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
</style>
<style lang="less" scoped>
/deep/.el-select {
  width: 300px;
  margin-bottom: 20px;
}
</style>

